#include "stdafx.h"
#include "CombatState.h"
#include "PauseState.h"
#include "Camera.h"
#include "FModManager.h"
#include "DebugObject.h"
#include "ObjectManager.h"
#include "dxdebug.h"
#include "math.h"
#include "DebugObject.h"
#include "Game.h"
#include "Player.h"
#include "BogRaiders.h"

CombatState::CombatState()
{
}

CombatState::~CombatState()
{
}

void CombatState::Init()
{
	//Clear Object Manager
	ObjectManager::GetInstance()->RemoveAllObjects();

	//Set up new Environment
	this->CreateEnvironment();

	//Set player position and camera position
	ObjectManager::GetInstance()->AddObject(Game::GetInstance()->GetPlayer());
	Game::GetInstance()->GetPlayer()->SetPosition(D3DXVECTOR3(800.0f, 50.0f, 1950.0f));
	CCamera::GetInstance()->SetCameraMode(OPEN_WORLD_CAMERA);
	//CCamera::GetInstance()->SetPosition(Game::GetInstance()->GetPlayer()->GetPosition());

	//Set up Player Stats

	//Set up NPC Stats

	DWORD color = 0xFF0000;

	D3DXVECTOR3 pos = Game::GetInstance()->GetPlayer()->GetPosition();
	pos.x += 10.0f;

	raider = new CrtBogRaiders();
 	raider->LoadMesh("resources\\robot-whitey.x");
	raider->SetPosition(D3DXVECTOR3(pos.x,pos.y,pos.z));
	raider->SetVelocity(D3DXVECTOR3(0.0f,0.0f,0.0f));
	raider->Create();
	ObjectManager::GetInstance()->AddObject(raider);
}

void CombatState::Update(float dt)
{

}

void CombatState::Render()
{
	ObjectManager::GetInstance()->RenderObjects();
}

void CombatState::Shutdown()
{

}

void  CombatState::CreateEnvironment()
{
	//Outter Box
	//CDebugAABB* pBounds = new CDebugAABB();
	//DWORD color; color = 0x66AA99;
	//D3DXVECTOR3 pos; pos.x = 1000.0f; pos.z = 2500.0f; pos.y = 200.0f;
	//D3DXVECTOR3 dim; dim.x = 2000.0f; dim.y = 400.0f; dim.z = 5000.0f;

	//pBounds->CreateBox(pos, dim, color);
	//ObjectManager::GetInstance()->AddObject(pBounds);
	//pBounds->Release();

	//color = 0x0000FF;
	//pBounds = new CDebugAABB();
}